#include <func.h>
void sigfunc(int signum,siginfo_t *p,void *p1)
{
    printf("signum is %d\n",signum);
    sleep(3);
    sigset_t pend;
    sigemptyset(&pend);
    sigpending(&pend);
    if(sigismember(&pend,SIGQUIT))
    {
        printf("SIGQUIT is pending now!\n");
    }
    printf("After signum is %d\n",signum);
}
int main(int argc,char *argv[])
{
    int ret;
    struct sigaction act;
    bzero(&act,sizeof(act));
    act.sa_sigaction=sigfunc;
    act.sa_flags=SA_SIGINFO|SA_NODEFER;//SA_NODEFER实现重入效果
    sigaddset(&act.sa_mask,SIGQUIT);//把3号信号加入阻塞信号集合
    ret=sigaction(SIGINT,&act,NULL);
    ret=sigaction(SIGQUIT,&act,NULL);
    ERROR_CHECK(ret,-1,"sigaction");
    while(1)
        sleep(1);
    return 0;
}

